Hệ thống quản lý phòng khám trực tuyến bằng PHP

1 <?php
2 // This script and data application were generated
by AppGini 5.62
3 // Download AppGini
for free from https://bigprof.com/appgini/download/
4
5     $currDir=dirname(__FILE__);
6     include(
"$currDir/defaultLang.php");
7     include(
"$currDir/language.php");
8     include(
"$currDir/lib.php");
9     @include(
"$currDir/hooks/events.php");
10     include(
"$currDir/events_dml.php");
11
12     
// mm: can the current member access this page?
13     $perm=getTablePermissions(
'events');
14     
if(!$perm[0]){
15         echo error_message($Translation[
'tableAccessDenied'], false);
16         echo
'<script>setTimeout("window.location=\'index.php?signOut=1\'", 2000);</script>';
17         exit;
18     }
19
20     $x =
new DataList;
21     $x->TableName =
"events";
22
23     
// Fields that can be displayed in the table view
24     $x->QueryFieldsTV = array(
25         
"`events`.`id`" => "id",
26         
"`events`.`title`" => "title",
27         
"if(`events`.`date`,date_format(`events`.`date`,'%m/%d/%Y'),'')" => "date",
28         
"`events`.`status`" => "status",
29         
"IF( CHAR_LENGTH(`patients1`.`last_name`) || CHAR_LENGTH(`patients1`.`first_name`), CONCAT_WS('', `patients1`.`last_name`, ',', `patients1`.`first_name`), '') /* Patient Name */" => "name_patient",
30         
"TIME_FORMAT(`events`.`time`, '%r')" => "time",
31         
"`events`.`prescription`" => "prescription",
32         
"`events`.`diagnosis`" => "diagnosis",
33         
"`events`.`comments`" => "comments"
34     );
35     
// mapping incoming sort by requests to actual query fields
36     $x->SortFields = array(
37         
1 => '`events`.`id`',
38         
2 => 2,
39         
3 => '`events`.`date`',
40         
4 => 4,
41         
5 => 5,
42         
6 => '`events`.`time`',
43         
7 => 7,
44         
8 => 8,
45         
9 => 9
46     );
47
48     
// Fields that can be displayed in the csv file
49     $x->QueryFieldsCSV = array(
50         
"`events`.`id`" => "id",
51         
"`events`.`title`" => "title",
52         
"if(`events`.`date`,date_format(`events`.`date`,'%m/%d/%Y'),'')" => "date",
53         
"`events`.`status`" => "status",
54         
"IF( CHAR_LENGTH(`patients1`.`last_name`) || CHAR_LENGTH(`patients1`.`first_name`), CONCAT_WS('', `patients1`.`last_name`, ',', `patients1`.`first_name`), '') /* Patient Name */" => "name_patient",
55         
"TIME_FORMAT(`events`.`time`, '%r')" => "time",
56         
"`events`.`prescription`" => "prescription",
57         
"`events`.`diagnosis`" => "diagnosis",
58         
"`events`.`comments`" => "comments"
59     );
60     
// Fields that can be filtered
61     $x->QueryFieldsFilters = array(
62         
"`events`.`id`" => "ID",
63         
"`events`.`title`" => "Appointment Type",
64         
"`events`.`date`" => "Date",
65         
"`events`.`status`" => "Status",
66         
"IF( CHAR_LENGTH(`patients1`.`last_name`) || CHAR_LENGTH(`patients1`.`first_name`), CONCAT_WS('', `patients1`.`last_name`, ',', `patients1`.`first_name`), '') /* Patient Name */" => "Patient Name",
67         
"`events`.`time`" => "Time",
68         
"`events`.`prescription`" => "Prescription",
69         
"`events`.`diagnosis`" => "Diagnosis",
70         
"`events`.`comments`" => "Comments"
71     );
72
73     
// Fields that can be quick searched
74     $x->QueryFieldsQS = array(
75         
"`events`.`id`" => "id",
76         
"`events`.`title`" => "title",
77         
"if(`events`.`date`,date_format(`events`.`date`,'%m/%d/%Y'),'')" => "date",
78         
"`events`.`status`" => "status",
79         
"IF( CHAR_LENGTH(`patients1`.`last_name`) || CHAR_LENGTH(`patients1`.`first_name`), CONCAT_WS('', `patients1`.`last_name`, ',', `patients1`.`first_name`), '') /* Patient Name */" => "name_patient",
80         
"TIME_FORMAT(`events`.`time`, '%r')" => "time",
81         
"`events`.`prescription`" => "prescription",
82         
"`events`.`diagnosis`" => "diagnosis",
83         
"`events`.`comments`" => "comments"
84     );
85
86     
// Lookup fields that can be used as filterers
87     $x->filterers = array(
'name_patient' => 'Patient Name');
88
89     $x->QueryFrom =
"`events` LEFT JOIN `patients` as patients1 ON `patients1`.`id`=`events`.`name_patient` ";
90     $x->QueryWhere =
'';
91     $x->QueryOrder =
'';
92
93     $x->AllowSelection =
1;
94     $x->HideTableView = ($perm[
2]==0 ? 1 : 0);
95     $x->AllowDelete = $perm[
4];
96     $x->AllowMassDelete =
false;
97     $x->AllowInsert = $perm[
1];
98     $x->AllowUpdate = $perm[
3];
99     $x->SeparateDV =
1;
100     $x->AllowDeleteOfParents =
0;
101     $x->AllowFilters =
1;
102     $x->AllowSavingFilters =
0;
103     $x->AllowSorting =
1;
104     $x->AllowNavigation =
1;
105     $x->AllowPrinting =
1;
106     $x->AllowCSV =
1;
107     $x->RecordsPerPage =
10;
108     $x->QuickSearch =
1;
109     $x->QuickSearchText = $Translation[
"quick search"];
110     $x->ScriptFileName =
"events_view.php";
111     $x->RedirectAfterInsert =
"events_view.php?SelectedID=#ID#";
112     $x->TableTitle =
"Appointments";
113     $x->TableIcon =
"table.gif";
114     $x->PrimaryKey =
"`events`.`id`";
115
116     $x->ColWidth = array(
150, 150, 150, 150, 150, 150, 150, 150);
117     $x->ColCaption = array(
"Appointment Type", "Date", "Status", "Patient Name", "Time", "Prescription", "Diagnosis", "Comments");
118     $x->ColFieldName = array(
'title', 'date', 'status', 'name_patient', 'time', 'prescription', 'diagnosis', 'comments');
119     $x->ColNumber = array(
2, 3, 4, 5, 6, 7, 8, 9);
120
121     
// template paths below are based on the app main directory
122     $x->Template =
'templates/events_templateTV.html';
123     $x->SelectedTemplate =
'templates/events_templateTVS.html';
124     $x->TemplateDV =
'templates/events_templateDV.html';
125     $x->TemplateDVP =
'templates/events_templateDVP.html';
126
127     $x->ShowTableHeader =
1;
128     $x->ShowRecordSlots =
0;
129     $x->TVClasses =
"";
130     $x->DVClasses =
"";
131     $x->HighlightColor =
'#FFF0C2';
132
133     
// mm: build the query based on current member's permissions
134     $DisplayRecords = $_REQUEST[
'DisplayRecords'];
135     
if(!in_array($DisplayRecords, array('user', 'group'))){ $DisplayRecords = 'all'; }
136     
if($perm[2]==1 || ($perm[2]>1 && $DisplayRecords=='user' && !$_REQUEST['NoFilter_x'])){ // view owner only
137         $x->QueryFrom.=
', membership_userrecords';
138         $x->QueryWhere=
"where `events`.`id`=membership_userrecords.pkValue and membership_userrecords.tableName='events' and lcase(membership_userrecords.memberID)='".getLoggedMemberID()."'";
139     }elseif($perm[
2]==2 || ($perm[2]>2 && $DisplayRecords=='group' && !$_REQUEST['NoFilter_x'])){ // view group only
140         $x->QueryFrom.=
', membership_userrecords';
141         $x->QueryWhere=
"where `events`.`id`=membership_userrecords.pkValue and membership_userrecords.tableName='events' and membership_userrecords.groupID='".getLoggedGroupID()."'";
142     }elseif($perm[
2]==3){ // view all
143         
// no further action
144     }elseif($perm[
2]==0){ // view none
145         $x->QueryFields = array(
"Not enough permissions" => "NEP");
146         $x->QueryFrom =
'`events`';
147         $x->QueryWhere =
'';
148         $x->DefaultSortField =
'';
149     }
150     
// hook: events_init
151     $render=TRUE;
152     
if(function_exists('events_init')){
153         $args=array();
154         $render=events_init($x, getMemberInfo(), $args);
155     }
156
157     
if($render) $x->Render();
158
159     
// hook: events_header
160     $headerCode=
'';
161     
if(function_exists('events_header')){
162         $args=array();
163         $headerCode=events_header($x->ContentType, getMemberInfo(), $args);
164     }
165     
if(!$headerCode){
166         include_once(
"$currDir/header.php");
167     }
else{
168         ob_start(); include_once(
"$currDir/header.php"); $dHeader=ob_get_contents(); ob_end_clean();
169         echo str_replace(
'<%%HEADER%%>', $dHeader, $headerCode);
170     }
171
172     echo $x->HTML;
173     
// hook: events_footer
174     $footerCode=
'';
175     
if(function_exists('events_footer')){
176         $args=array();
177         $footerCode=events_footer($x->ContentType, getMemberInfo(), $args);
178     }
179     
if(!$footerCode){
180         include_once(
"$currDir/footer.php");
181     }
else{
182         ob_start(); include_once(
"$currDir/footer.php"); $dFooter=ob_get_contents(); ob_end_clean();
183         echo str_replace(
'<%%FOOTER%%>', $dFooter, $footerCode);
184     }
185 ?>


Gõ tìm kiếm nhanh...